﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;

namespace Bussiness_Objects
{
    /// <summary>
    /// Thong tin table TACGIA
    /// --TACGIA(MaTacGia,TenTacGia,NgaySinh)
    /// </summary>
    public class TacGia : BusinessObjects
    {
        public TacGia()
        {
            Ten = null;
            MaTG = int.MaxValue;
            NgaySinh = null;
        }

        public TacGia(int _maTg, string _ten, string _ngSinh)
        {
            Ten = _ten;
            MaTG = _maTg;
            NgaySinh = _ngSinh;
        }

        public void SetParameterSelectID()
        {
            parms = new object[1];
            SqlParameter _parm = new SqlParameter(parMaTG, MaTG);
            parms[0] = _parm;
        }

        public override void SetParameterInsert()
        {
            parms = new object[2];
            SqlParameter _param = new SqlParameter(parTen, Ten);
            parms[0] = _param;

            _param = new SqlParameter(parNgaySinh, NgaySinh);
            parms[1] = _param;            
        }

        public override void SetParameterUpdate()
        {
            parms = new object[3];
            SqlParameter _param = new SqlParameter(parTen, Ten);
            parms[0] = _param;

            _param = new SqlParameter(parNgaySinh, NgaySinh);
            parms[1] = _param;

            _param = new SqlParameter(parMaTG, MaTG);
            parms[2] = _param;
        }

        public string Ten { get; set; }
        private const string parTen = "@TenTacGia";

        public int MaTG { get; set; }
        private const string parMaTG = "@MaTacGia";

        public string NgaySinh { get; set; }
        private const string parNgaySinh = "@NgaySinh";
    }
}
